<?php

namespace api\controller;

// +----------------------------------------------------------------------
// | 状态数据控制层
// +----------------------------------------------------------------------

use common\controller\VerifyController;
use common\service\StatusService;
use think\Request;
use think\Response;

class StatusController extends VerifyController
{
    public function __construct()
    {
        parent::__construct();
        $this->statusService = StatusService::getInstance();
    }

    /**
     * 获取状态从属字典数据列表
     * @param Request $request
     * @return Response
     */
    public function getCorrespondList(Request $request)
    {
        $data = [
            ['id' => 'blocked', 'name' => "Blocked"],
            ['id' => 'not_started', 'name' => "Not Started"],
            ['id' => 'in_progress', 'name' => "In Progress"],
            ['id' => 'daily', 'name' => "Daily"],
            ['id' => 'feedback', 'name' => "Feedback"],
            ['id' => 'wait_publish', 'name' => "Wait Publish"],
            ['id' => 'done', 'name' => "Done"],
            ['id' => 'hide', 'name' => "Hide"]
        ];

        return json(success_response('', $data));
    }

    /**
     * 查询默认状态
     * @param Request $request
     * @return Response
     */
    public function getDefaultStatus(Request $request)
    {
        $res = $this->statusService->getDefaultStatus($request->param()['name']);
        return json(success_response('', $res));
    }
}
